Partial Public Class Grupo
    Private objP As Plan

    Public Property darPlan() As Plan
        Get
            Return objP
        End Get
        Set(ByVal pplan As Plan)
            objP = pplan
        End Set
    End Property

    Public Sub establecerPlan(ByVal prubro As String, ByVal pporcentaje As String, ByVal ptipo As Boolean, ByVal pextra As Boolean)
        Me.darPlan.crearRubro(prubro, pporcentaje, ptipo, pextra)
    End Sub

    Public Function mostrarP() As ArrayList
        Dim dt As DataTable = New accesoBD.TripleCDataSetTableAdapters.buscarPlanTableAdapter().GetData(Me.idGrupo)
        Dim arr As New ArrayList
        Dim actu As Double
        actu = dt.Rows.Item(0).Item(1)
        arr.Add(actu)
        Return arr
    End Function

    Public Function mostrarRubs() As DataTable
        'Dim da As DataTable = New accesoBD.TripleCDataSetTableAdapters.buscarPlanTableAdapter().GetData(idGrupo)
        'Dim id As Integer = CInt(da.Rows.Item(0).Item(0))
        'Dim cant As Double = CType(da.Rows.Item(0).Item(1), Double)
        'objP = New Plan(id, cant)
        Me.obtenerPlan()
        Return objP.datosRubro()
    End Function


    Public Sub modRubro(ByVal pid As Integer, ByVal prubro As String, ByVal pporcentaje As String, ByVal ptipo As Boolean, ByVal pextra As Boolean, ByVal pactual As Double, ByVal pinicial As Double)
        Me.obtenerPlan()
        objP.modificar(pid, prubro, pporcentaje, ptipo, pextra, pactual, pinicial)
    End Sub

    Public Sub elimRubro(ByVal pid As Integer)
        objP.delete(pid)
    End Sub

    Public Property darId()
        Get
            Return idGrupo
        End Get
        Set(ByVal pid)
            idGrupo = pid
        End Set
    End Property

    Public Sub crearPlan()
        objP = New Plan()
    End Sub

    Public Function mostrarRubros() As DataTable
        'Dim da As DataTable = New accesoBD.TripleCDataSetTableAdapters.buscarPlanTableAdapter().GetData(idGrupo)
        'Dim id As Integer = CInt(da.Rows.Item(0).Item(0))
        'Dim cant As Double = CType(da.Rows.Item(0).Item(1), Double)
        'objP = New Plan(id, cant)
        Me.obtenerPlan()
        Return objP.obtenerRubros()
    End Function

    Private Sub obtenerPlan()
        Dim da As DataTable = New accesoBD.TripleCDataSetTableAdapters.buscarPlanTableAdapter().GetData(idGrupo)
        Dim id As Integer = CInt(da.Rows.Item(0).Item(0))
        Dim cant As Double = CType(da.Rows.Item(0).Item(1), Double)
        objP = New Plan(id, cant)
    End Sub

End Class
